### **Instruction for Installing JDK 21 (LTS)** #### **For macOS** 1. **Download the JDK**: - Go to the [Oracle JDK Downloads page](https://www.oracle.com/java/technologies/downloads/). - Select **Java SE Development Kit 21 (LTS)** and choose the macOS installer (`.dmg` file). 2. **Install the JDK**: - Double-click the downloaded `.dmg` file to open it. - Follow the installation prompts to complete the process. 3. **Verify Installation**: - Open the Terminal and run: ```bash java --version ``` - You should see output like `java 21 LTS`. 4. **Set JAVA_HOME Environment Variable (Optional)**: - Open Terminal and edit your shell profile (`.zshrc` or `.bash_profile`): ```bash nano ~/.zshrc ``` - Add the following line: ```bash export JAVA_HOME=$(/usr/libexec/java_home -v 21) ``` - Save and reload the profile: ```bash source ~/.zshrc ``` --- #### **For Windows** 1. **Download the JDK**: - Visit the [Oracle JDK Downloads page](https://www.oracle.com/java/technologies/downloads/). - Select **Java SE Development Kit 21 (LTS)** and download the `.exe` installer for Windows. 2. **Install the JDK**: - Run the `.exe` file and follow the installation wizard. - By default, the JDK will be installed in `C:\Program Files\Java\jdk-21`. 3. **Verify Installation**: - Open Command Prompt and run: ```cmd java --version ``` - You should see output like `java 21 LTS`. 4. **Set JAVA_HOME Environment Variable**: - Open **Control Panel** > **System** > **Advanced System Settings**. - In the **System Properties** window, click **Environment Variables**. - Under **System Variables**, click **New** and add: - **Variable Name**: `JAVA_HOME` - **Variable Value**: `C:\Program Files\Java\jdk-21` - Add `%JAVA_HOME%\bin` to the `Path` variable.